package Frame.screen;

import FCRendering.FCRBattleOrderConstant;
import FCRendering.FCRConstants;
import FCRendering.FCRMaster;
import FCRendering.ImageUtil;
import Frame.battleanimation.ABattleAni;
import Function.Utils.SwingUtil;
import VWorldGameStudio.*;
import socket.FCRSocketClient;
import socket.FCRSocketServer;
import utils.ClickHelper;
import Function.FCMutilPlayCache;
import utils.FCUIConfig;
import utils.entity.UIConfigEntity;

import java.awt.*;
import java.awt.event.MouseEvent;
import java.util.ArrayList;

import static FCRendering.FCRMaster.*;

//战斗地图
public class DefaultFightScreen extends IScreen implements IRListener {

    /**
     * 是true就显示humanmenu， 否就坦克菜单
     */
    private boolean showHumanOrTankMenu = true;
    private String[] fightMenuNames = new String[]{"fightMenuName1", "fightMenuName2", "fightMenuName3", "fightMenuName4"};
    private FightHumanMenuScreen humanMenuScreen = new FightHumanMenuScreen();
    private FightTankMenuScreen tankMenuScreen = new FightTankMenuScreen();
    private IRListener defMenulistner = humanMenuScreen;
    private Font font1 = null;
    private Font font2 = null;
    private Font font3 = null;
    private Font font4 = null;
    private ClickHelper clickHelper = new ClickHelper(500);
    private ArrayList<String> tmpState = new ArrayList<>(6);

    @Override
    public void listen_mouse_click_game(MouseEvent g) {
        int x = g.getX(), y = g.getY();
        if (fcv.getBattleSayText().size() > 0) {
            if (clickHelper.canClick()) {
                if (FCUIConfig.getIn().checkUIClick("fightSayClickArea", x, y)) {
                    fcv.getBattleSayText().pop();
                    if (fcv.getBattleSayText().size() == 0 && fcv.getBattleEvent() == null) {
                        //TODO 战斗结束了,进行结算
                        fcv.setBattleSummary(true);
                    }
                }
            }
            return;
        }

        if (g.getButton() != 3) {
            if (fcv.isBattlePlayerSelect()) {
                FCPlayerBattleWrap selectPlayerWrap = fcv.getBattleWraps().get(fcv.getFightSelectPlayer());
                boolean clickDispose = false;
                for (int i = 0; i < FCRMaster.fcv.getBattleMonsterCoor().size(); i++) {
                    if (!FCRMaster.fcv.getBattleMonster().get(i).getIsDeath()) {
                        Integer[] qw = FCRMaster.fcv.getBattleMonsterCoor().get(i);
                        if (x > qw[0] && x < qw[0] + qw[2] && y > qw[1] && y < qw[1] + qw[3]) {
                            selectPlayerWrap.setBattlePlayerSelectMonster(i);

                            //TODO 记住了，一定要在这里判断是徒手攻击还是武器攻击,坦克的话，也要设置是那种
                            if (selectPlayerWrap.getBattleAttackOrder() == FCRBattleOrderConstant.Order_USEITEM) {
                                //TODO 使用道具的方式
                                selectPlayerWrap.setBattleUseItemType(1);
                                selectPlayerWrap.setBattlePlayerSelectMenu(FCRBattleOrderConstant.BattleSelectMenuThowItem);
                            } else {
                                if (defMenulistner == humanMenuScreen) {
                                    FCPlayerInfo playerInfo = FCMutilPlayCache.findPlayerByName(selectPlayerWrap.getHostUid(), selectPlayerWrap.getName());
                                    if (playerInfo != null && itemLib.getItemOfID(playerInfo.getArm()) != null) {
                                        selectPlayerWrap.setUseWeaponType(itemLib.getItemOfID(playerInfo.getArm()).getType2());
                                        selectPlayerWrap.setBattlePlayerSelectMenu(FCRBattleOrderConstant.BattleSelectMenuArmGun);
                                    } else {
                                        selectPlayerWrap.setBattlePlayerSelectMenu(FCRBattleOrderConstant.BattleSelectMenuTushou);
                                    }
                                } else {
                                    //TODO 坦克状态下的攻击在别处tankMenuScreen已经设置了，这里不用做任何逻辑
                                }
                            }

                            selectPlayerWrap.setBattleReady(true);
                            //TODO 必须和setBattleReady - true一起

                            if (defMenulistner == humanMenuScreen) {
                                humanMenuScreen.selectNextPlayer();
                            } else {
                                tankMenuScreen.selectNextPlayer();
                            }
                            fcv.setBattlePlayerSelect(false);
                            clickDispose = true;
                        }
                    }
                }
                if (!clickDispose && selectPlayerWrap.getBattleAttackOrder() == FCRBattleOrderConstant.Order_USEITEM) {
                    //检查有没对准人使用道具
                    for (FCPlayerBattleWrap w : fcv.getBattleWraps()) {
                        if (x > w.getCoorX() && x < (w.getCoorX() + w.getW()) && y > w.getCoorY() && y < (w.getCoorY() + w.getH())) {
                            selectPlayerWrap.setBattlePlayerSelectPlayer(w.getHostUid() + "," + w.getName());
                            selectPlayerWrap.setBattleUseItemType(2);
                            selectPlayerWrap.setBattlePlayerSelectMenu(FCRBattleOrderConstant.BattleSelectMenuThowItem);
                            selectPlayerWrap.setBattleReady(true);

                            if (defMenulistner == humanMenuScreen) {
                                humanMenuScreen.selectNextPlayer();
                            } else {
                                tankMenuScreen.selectNextPlayer();
                            }
                            fcv.setBattlePlayerSelect(false);
                            break;
                        }
                    }
                }
            } else {
                //非选中目标状态
                ArrayList<FCPlayerBattleWrap> ws = FCPlayerBattleWrap.findAllWrapByHostId(gameSave.HOST_UID);
                for (int i = 0; i < ws.size(); i++) {
                    if (FCUIConfig.getIn().checkUIClick(fightMenuNames[i], x, y)) {
                        selectPlayer(fcv.getBattleWraps().indexOf(ws.get(i)));
                        break;
                    }
                    if (i == (fcv.getBattleWraps().size() - 1)) {
                        break;
                    }
                }
                FCPlayerBattleWrap wrap = fcv.getBattleWraps().get(fcv.getFightSelectPlayer());
                FCPlayerInfo playerInfo = FCMutilPlayCache.findPlayerByName(wrap.getHostUid(), wrap.getName());
                if (FCPlayerBattleWrap.canThisBattle(wrap) && playerInfo != null && !playerInfo.isDeath()) {
                    defMenulistner.listen_mouse_click_game(g);
                }
            }
        } else {
            if (fcv.isBattlePlayerSelect()) {
                //右键取消
                fcv.setBattlePlayerSelect(false);
            }
        }
    }

    @Override
    public void listen_mouse_move_game(MouseEvent g) {
        int x = g.getX(), y = g.getY();
        if (fcv.getBattleSayText().size() > 0) {
            return;
        }
        for (int i = 0; i < 4; i++) {
            if (FCUIConfig.getIn().checkUIClick(fightMenuNames[i], x, y)) {
                fcv.setEnterBu(80 + i);
                break;
            }
            fcv.setEnterBu(0);
            if (i == (fcv.getBattleWraps().size() - 1)) {
                break;
            }
        }
        if (fcv.getBattleWraps().size() > 0) {
            FCPlayerBattleWrap wrap = fcv.getBattleWraps().get(fcv.getFightSelectPlayer());
            FCPlayerInfo playerInfo = FCMutilPlayCache.findPlayerByName(wrap.getHostUid(), wrap.getName());
            if (playerInfo != null && !playerInfo.isDeath()) {
                defMenulistner.listen_mouse_move_game(g);
            }
        }
    }

    @Override
    public void listen_mouse_release_game(MouseEvent g) {
        int x = g.getX(), y = g.getY();
        if (g.getButton() == 1 && fcv.isOpenMenu() && fcv.getOpenMenuNum() == 0 && FCRMaster.fcv.isMoveKnapsackItem()) {
            FCPlayerInfo fcPlayerInfo = FCMutilPlayCache.findPlayerByName(gameSave.HOST_UID, fcv.getShowWhosBagItem());
            // STEP 1卸装备
            if (y > (int) (1016 * FCRMaster.fcv.getProportion()) && y < (int) (1066 * FCRMaster.fcv.getProportion())) {
                for (int i = 0; i < 10; i++) {
                    if (x > (int) ((647 + i * 64) * FCRMaster.fcv.getProportion())
                            && x < (int) ((697 + i * 64) * FCRMaster.fcv.getProportion())) {
                        //把装备卸下来，要判断下能不能放，如果这个格子有物品了，不能放
                        String oldItem = fcPlayerInfo.getKnapsackItemIDOfNum(i);
                        if (oldItem == null || oldItem.equals("null")) {
                            //空格子才能把装备卸下来
//                            fcPlayerInfo.insertItemToKnapsack(i, FCRMaster.fcv.getKnapsackItemName());
//                            FCPlayerInfo oldman = FCMutilPlayCache.findPlayerByName(gameSave.HOST_UID, fcv.getKnapsackItemWho());
//                            if (FCRMaster.fcv.getTakeOffArmorType() == 0) {
//                                oldman.setArm("null");
//                            } else if (FCRMaster.fcv.getTakeOffArmorType() == 1) {
//                                oldman.setHat("null");
//                            } else if (FCRMaster.fcv.getTakeOffArmorType() == 2) {
//                                oldman.setJacket("null");
//                            } else if (FCRMaster.fcv.getTakeOffArmorType() == 3) {
//                                oldman.setPants("null");
//                            } else if (FCRMaster.fcv.getTakeOffArmorType() == 4) {
//                                oldman.setShoes("null");
//                            } else if (FCRMaster.fcv.getTakeOffArmorType() == 5) {
//                                oldman.setGlove("null");
//                            }
//                            if (FCRMaster.fcv.getTakeOffArmorType() >= 0) {
//                                syncEquipToNet(oldman);
//                            }

                            //TODO 创建装备的指令
                            FCPlayerBattleWrap cp = fcv.getBattleWraps().get(fcv.getFightSelectPlayer());
                            cp.setKnapsackItemWho(fcv.getKnapsackItemWho());
                            cp.setBattlePlayerSelectItemMode(1);
                            cp.setKnapsackItemNum(i);
                            cp.setTakeOffArmorType(FCRMaster.fcv.getTakeOffArmorType());
                            cp.setBattleAttackOrder(FCRBattleOrderConstant.Order_EQUIP);
                            cp.setBattlePlayerSelectMenu(FCRBattleOrderConstant.BattleSelectTakeOffArmor);
                            cp.setBattleReady(true);
                            selectNextPlayer();
                            fcv.setBattlePlayerSelect(false);
                            fcv.getMessage().add("Tips:装备将会战斗回合中更换!");
                            fcv.showMessage();
                        }
                        FCRMaster.fcv.setTakeOffArmorType(-1);
                        FCRMaster.fcv.setKnapsackItemNum(-1);
                        FCRMaster.fcv.setKnapsackItemName("null");
                        FCRMaster.fcv.setMoveKnapsackItem(false);
                        return;
                    }
                }
            } else if (y > (int) (930 * FCRMaster.fcv.getProportion()) && y < (int) (984 * FCRMaster.fcv.getProportion())) {
                FCTank tank = tankLib.getTankOfID(fcPlayerInfo.getPlayertank1(), fcPlayerInfo.getPlayertankHostId());
                if (tank != null) {
                    for (int i = 0; i < 10; i++)
                        if (x > (int) ((647 + i * 64) * FCRMaster.fcv.getProportion())
                                && x < (int) ((697 + i * 64) * FCRMaster.fcv.getProportion())) {
                            String oldItem = tank.getKnapsackItemIDOfNum(i);
                            if (oldItem == null || oldItem.equals("null")) {
//                                tank.insertItemToKnapsack(i, FCRMaster.fcv.getKnapsackItemName());
//                                tank.reInitShuxing();
                                //卸载人类装备

                                //空格子才能把装备卸下来
//                                    FCPlayerInfo oldman = FCMutilPlayCache.findPlayerByName(gameSave.HOST_UID, fcv.getKnapsackItemWho());
//                                    if (FCRMaster.fcv.getTakeOffArmorType() == 0) {
//                                        oldman.setArm("null");
//                                    } else if (FCRMaster.fcv.getTakeOffArmorType() == 1) {
//                                        oldman.setHat("null");
//                                    } else if (FCRMaster.fcv.getTakeOffArmorType() == 2) {
//                                        oldman.setJacket("null");
//                                    } else if (FCRMaster.fcv.getTakeOffArmorType() == 3) {
//                                        oldman.setPants("null");
//                                    } else if (FCRMaster.fcv.getTakeOffArmorType() == 4) {
//                                        oldman.setShoes("null");
//                                    } else if (FCRMaster.fcv.getTakeOffArmorType() == 5) {
//                                        oldman.setGlove("null");
//                                    }
//                                    if (FCRMaster.fcv.getTakeOffArmorType() >= 0) {
//                                        syncEquipToNet(oldman);
//                                    }
                                FCPlayerBattleWrap cp = fcv.getBattleWraps().get(fcv.getFightSelectPlayer());
                                cp.setKnapsackItemWho(fcv.getKnapsackItemWho());
                                cp.setBattlePlayerSelectItemMode(2);
                                cp.setKnapsackItemNum(i);
                                cp.setTakeOffArmorType(FCRMaster.fcv.getTakeOffArmorType());
                                cp.setBattleAttackOrder(FCRBattleOrderConstant.Order_EQUIP);
                                cp.setBattlePlayerSelectMenu(FCRBattleOrderConstant.BattleSelectTakeOffArmor);
                                cp.setBattleReady(true);
                                selectNextPlayer();
                                fcv.setBattlePlayerSelect(false);
                                fcv.getMessage().add("Tips:装备将会战斗回合中更换!");
                                fcv.showMessage();
                            }
                            FCRMaster.fcv.setTakeOffArmorType(-1);
                            FCRMaster.fcv.setKnapsackItemNum(-1);
                            FCRMaster.fcv.setKnapsackItemName("null");
                            FCRMaster.fcv.setMoveKnapsackItem(false);
                            return;
                        }
                }
            }

            //STEP 2装备装备
            if (FCRMaster.fcv.isMoveKnapsackItem() && FCRMaster.fcv.getKnapsackItemName() != null
                    && !FCRMaster.fcv.getKnapsackItemName().equals("null") && FCRMaster.fcv.getTakeOffArmorType() == -1) {
                if (FCRMaster.fcv.getOpenMenuNum() == 0) {
                    //TODO 如果是人类装备界面
                    FCItem moveItem = FCRMaster.itemLib.getItemOfID(FCRMaster.fcv.getKnapsackItemName());
                    String itemtype = moveItem.getType();
                    int offsetY = (int) (50 * fcv.getProportion());
                    for (int i = 0; i < FCMutilPlayCache.getTeamMembers().size() + 1; i++) {
                        FCPlayerInfo p = null;
                        if (i == 0) {
                            p = player1;
                        } else {
                            FCRPlayerLink link = FCMutilPlayCache.getTeamMembers().get(i - 1);
                            if (link.curPlayerHostUID.equals(gameSave.HOST_UID)) {
                                p = FCMutilPlayCache.findPlayerByName(gameSave.HOST_UID, link.curPlayerName);
                            }
                        }
                        if (p == null) {
                            continue;
                        }

                        if (x > 539 * FCRMaster.fcv.getProportion() && x < 581 * FCRMaster.fcv.getProportion() && y > offsetY + 252.5 * FCRMaster.fcv.getProportion()
                                && y < offsetY + 294.5 * FCRMaster.fcv.getProportion()) // 装备武器
                        {
                            if (itemtype.equals("arm")) {
                                if (!moveItem.getEnableOccupation().contains(p.getOccupation())) {
                                    fcv.getMessage().add("职业限制无法装备!");
                                    fcv.showMessage();
                                } else {
                                      replaceOrDelKnapsack(0, p);
//                                    String oldItem = p.getArm();
//                                    p.setArm(FCRMaster.fcv.getKnapsackItemName());
//                                    replaceOrDelKnapsack(oldItem);
//                                    syncEquipToNet(p);
                                }
                            }
                            break;
                        }
                        if (x > 505 * FCRMaster.fcv.getProportion() && x < 539 * FCRMaster.fcv.getProportion() && y > offsetY + 218.5 * FCRMaster.fcv.getProportion()
                                && y < offsetY + 252.5 * FCRMaster.fcv.getProportion()) // 装备帽子
                        {
                            if (itemtype.equals("hat")) {
                                if (!moveItem.getEnableOccupation().contains(p.getOccupation())) {
                                    fcv.getMessage().add("职业限制无法装备!");
                                    fcv.showMessage();
                                } else {
                                    replaceOrDelKnapsack(1, p);
//                                    String oldItem = p.getHat();
//                                    p.setHat(FCRMaster.fcv.getKnapsackItemName());
//                                    replaceOrDelKnapsack(oldItem);
//                                    syncEquipToNet(p);
                                }
                            }
                            break;
                        }
                        if (x > 581 * FCRMaster.fcv.getProportion() && x < 615 * FCRMaster.fcv.getProportion() && y > offsetY + 218.5 * FCRMaster.fcv.getProportion()
                                && y < offsetY + 252.5 * FCRMaster.fcv.getProportion()) // 装备上衣
                        {
                            if (itemtype.equals("jacket")) {
                                if (!moveItem.getEnableOccupation().contains(p.getOccupation())) {
                                    fcv.getMessage().add("职业限制无法装备!");
                                    fcv.showMessage();
                                } else {
                                    replaceOrDelKnapsack(2, p);
//                                    String oldItem = p.getJacket();
//                                    p.setJacket(FCRMaster.fcv.getKnapsackItemName());
//                                    replaceOrDelKnapsack(oldItem);
//                                    syncEquipToNet(p);
                                }
                            }
                            break;
                        }
                        if (x > 505 * FCRMaster.fcv.getProportion() && x < 539 * FCRMaster.fcv.getProportion() && y > offsetY + 294.5 * FCRMaster.fcv.getProportion()
                                && y < offsetY + 328.5 * FCRMaster.fcv.getProportion()) // 装备防弹衣
                        {
                            if (itemtype.equals("pants")) {
                                if (!moveItem.getEnableOccupation().contains(p.getOccupation())) {
                                    fcv.getMessage().add("职业限制无法装备!");
                                    fcv.showMessage();
                                } else {
                                    replaceOrDelKnapsack(3, p);
//                                    String oldItem = p.getPants();
//                                    p.setPants(gameSave.checkOtherItem(FCRMaster.fcv.getKnapsackItemName()));
//                                    replaceOrDelKnapsack(oldItem);
//                                    syncEquipToNet(p);
                                }
                            }
                            break;
                        }
                        if (x > 458 * FCRMaster.fcv.getProportion() && x < 502 * FCRMaster.fcv.getProportion() && y > offsetY + 294.5 * FCRMaster.fcv.getProportion()
                                && y < offsetY + 328.5 * FCRMaster.fcv.getProportion()) // 装备手套
                        {
                            if (itemtype.equals("glove")) {
                                if (!moveItem.getEnableOccupation().contains(p.getOccupation())) {
                                    fcv.getMessage().add("职业限制无法装备!");
                                    fcv.showMessage();
                                } else {
                                    replaceOrDelKnapsack(5, p);
//                                    String oldItem = p.getGlove();
//                                    p.setGlove(FCRMaster.fcv.getKnapsackItemName());
//                                    replaceOrDelKnapsack(oldItem);
//                                    syncEquipToNet(p);
                                }
                            }
                            break;
                        }
                        if (x > 581 * FCRMaster.fcv.getProportion() && x < 615 * FCRMaster.fcv.getProportion() && y > offsetY + 294.5 * FCRMaster.fcv.getProportion()
                                && y < offsetY + 328.5 * FCRMaster.fcv.getProportion()) // 装备鞋子
                        {
                            if (itemtype.equals("shoes")) {
                                if (!moveItem.getEnableOccupation().contains(p.getOccupation())) {
                                    fcv.getMessage().add("职业限制无法装备!");
                                    fcv.showMessage();
                                } else {
                                    replaceOrDelKnapsack(4, p);
//                                    String oldItem = p.getShoes();
//                                    p.setShoes(FCRMaster.fcv.getKnapsackItemName());
//                                    replaceOrDelKnapsack(oldItem);
//                                    syncEquipToNet(p);
                                }
                            }
                            break;
                        }

                        offsetY += (int) (145 * fcv.getProportion());
                    }
                }
            }
        }
    }

    private void replaceOrDelKnapsack(int armorType, FCPlayerInfo p){
        FCPlayerBattleWrap cp = fcv.getBattleWraps().get(fcv.getFightSelectPlayer());
        cp.setKnapsackItemWho(p.getName());
        cp.setBattlePlayerSelectItemMode(FCRMaster.fcv.getKnapsackItemType());
        cp.setKnapsackItemNum(FCRMaster.fcv.getKnapsackItemNum());
        cp.setTakeOffArmorType(armorType);
        cp.setBattleAttackOrder(FCRBattleOrderConstant.Order_EQUIP);
        cp.setBattlePlayerSelectMenu(FCRBattleOrderConstant.BattleSelectTakeUpArmor);
        cp.setBattleReady(true);
        selectNextPlayer();
        fcv.setBattlePlayerSelect(false);
        fcv.getMessage().add("Tips:装备将会战斗回合中更换!");
        fcv.showMessage();

        FCRMaster.fcv.setKnapsackItemNum(-1);
        FCRMaster.fcv.setKnapsackItemName("null");
        FCRMaster.fcv.setMoveKnapsackItem(false);
    }


    @Override
    public void listen_mouse_press_game(MouseEvent g) {
        int x = g.getX(), y = g.getY();
        if (g.getButton() == 1 && fcv.isOpenMenu() && fcv.getOpenMenuNum() == 0) {
            FCPlayerInfo fcPlayerInfo = FCMutilPlayCache.findPlayerByName(gameSave.HOST_UID, fcv.getShowWhosBagItem());
            // 人物背包
            if (y > (int) (1016 * FCRMaster.fcv.getProportion()) && y < (int) (1066 * FCRMaster.fcv.getProportion()) && FCRMaster.fcv.getCaseSelectNum() < 0) {
                for (int i = 0; i < 10; i++) {
                    if (x > (int) ((647 + i * 64) * FCRMaster.fcv.getProportion()) && x < (int) ((697 + i * 64) * FCRMaster.fcv.getProportion())) {
                        String pIName = fcPlayerInfo.getKnapsack()[i];
                        if (pIName != null && !pIName.equals("null")) {
                            FCRMaster.fcv.setKnapsackItemNum(i);
                            FCRMaster.fcv.setKnapsackItemType(1);
                            FCRMaster.fcv.setKnapsackItemName(fcPlayerInfo.getKnapsackItemIDOfNum(i));
                            FCRMaster.fcv.setKnapsackItemWho(fcv.getShowWhosBagItem());
                            FCRMaster.fcv.setMoveKnapsackItem(true);
                        }
                        return;
                    }
                }
            } else if (y > (int) (930 * FCRMaster.fcv.getProportion()) && y < (int) (984 * FCRMaster.fcv.getProportion())) {
                //坦克背包
                FCTank tank = tankLib.getTankOfID(fcPlayerInfo.getPlayertank1(), fcPlayerInfo.getPlayertankHostId());
                if (tank != null) {
                    for (int i = 0; i < 10; i++) {
                        if (x > (int) ((647 + i * 64) * FCRMaster.fcv.getProportion()) && x < (int) ((697 + i * 64) * FCRMaster.fcv.getProportion())) {
                            String tankIName = tank.getKnapsack()[i];
                            if (tankIName != null && !tankIName.equals("null")) {
                                if (tankIName.contains(FCRConstants.QianZhuName) || tankIName.contains(FCRConstants.BridShitName)) {
                                    fcv.getMessage().add("该物品只能清洗店去掉!");
                                    fcv.showMessage();
                                } else {
                                    FCRMaster.fcv.setKnapsackItemNum(i);
                                    FCRMaster.fcv.setKnapsackItemType(2);
                                    FCRMaster.fcv.setDragBagWitchTank(tank);
                                    FCRMaster.fcv.setKnapsackItemName(tank.getKnapsackItemIDOfNum(i));
                                    FCRMaster.fcv.setKnapsackItemWho(fcv.getShowWhosBagItem());
                                    FCRMaster.fcv.setMoveKnapsackItem(true);
                                }
                            }
                            return;
                        }
                    }
                }
            }

            //STEP 2是不是卸装备？
            FCRMaster.fcv.setTakeOffArmorType(-1);
            int offsetY = (int) (50 * fcv.getProportion());
            for (int i = 0; i < FCMutilPlayCache.getTeamMembers().size() + 1; i++) {
                FCPlayerInfo p = null;
                if (i == 0) {
                    p = player1;
                } else {
                    FCRPlayerLink link = FCMutilPlayCache.getTeamMembers().get(i - 1);
                    if (link.curPlayerHostUID.equals(gameSave.HOST_UID)) {
                        p = FCMutilPlayCache.findPlayerByName(gameSave.HOST_UID, link.curPlayerName);
                    }
                }
                if (p == null) {
                    continue;
                }
                if (x > 539 * FCRMaster.fcv.getProportion() && x < 581 * FCRMaster.fcv.getProportion() && y > offsetY + 252.5 * FCRMaster.fcv.getProportion()
                        && y < offsetY + 294.5 * FCRMaster.fcv.getProportion()) {
                    takeOffArmor(p, p.getArm(), 0);
                    break;
                } else if (x > 505 * FCRMaster.fcv.getProportion() && x < 539 * FCRMaster.fcv.getProportion() && y > offsetY + 218.5 * FCRMaster.fcv.getProportion()
                        && y < offsetY + 252.5 * FCRMaster.fcv.getProportion()) {
                    takeOffArmor(p, p.getHat(), 1);
                    break;
                } else if (x > 581 * FCRMaster.fcv.getProportion() && x < 615 * FCRMaster.fcv.getProportion() && y > offsetY + 218.5 * FCRMaster.fcv.getProportion()
                        && y < offsetY + 252.5 * FCRMaster.fcv.getProportion()) {
                    takeOffArmor(p, p.getJacket(), 2);
                    break;
                } else if (x > 458 * FCRMaster.fcv.getProportion() && x < 502 * FCRMaster.fcv.getProportion() && y > offsetY + 294.5 * FCRMaster.fcv.getProportion()
                        && y < offsetY + 628.5 * FCRMaster.fcv.getProportion()) {
                    takeOffArmor(p, p.getGlove(), 5);
                    break;
                } else if (x > 505 * FCRMaster.fcv.getProportion() && x < 539 * FCRMaster.fcv.getProportion() && y > offsetY + 294.5 * FCRMaster.fcv.getProportion()
                        && y < offsetY + 628.5 * FCRMaster.fcv.getProportion()) {
                    takeOffArmor(p, p.getPants(), 3);
                    break;
                } else if (x > 581 * FCRMaster.fcv.getProportion() && x < 615 * FCRMaster.fcv.getProportion() && y > offsetY + 294.5 * FCRMaster.fcv.getProportion()
                        && y < offsetY + 328.5 * FCRMaster.fcv.getProportion()) {
                    takeOffArmor(p, p.getShoes(), 4);
                    break;
                }
                offsetY += (int) (145 * fcv.getProportion());
            }
        }
    }

    private boolean takeOffArmor(FCPlayerInfo p, String itemName, int type) {
        if (itemName != null && !itemName.equals("null")) {
            FCRMaster.fcv.setTakeOffArmorType(type);
            FCRMaster.fcv.setKnapsackItemNum(-1);
            FCRMaster.fcv.setKnapsackItemType(1);
            FCRMaster.fcv.setKnapsackItemName(itemName);
            FCRMaster.fcv.setKnapsackItemWho(p.getName());
            FCRMaster.fcv.setMoveKnapsackItem(true);
            return true;
        }
        return false;
    }

    @Override
    public void listen_key_press_game(String key) {
        if (fcv.getBattleSayText().size() > 0) {
            if (clickHelper.canClick()) {
                fcv.getBattleSayText().pop();
                if (fcv.getBattleSayText().size() == 0 && fcv.getBattleEvent() == null) {
                    //TODO 战斗结束了,进行结算
                    fcv.setBattleSummary(true);
                }
            }
            return;
        }
        FCRMaster.fcv.setBattleShowListX(fcv.getMouseX());
        FCRMaster.fcv.setBattleShowListY(fcv.getMouseY());
        defMenulistner.listen_key_press_game(key);
    }

    @Override
    public void dispatchPaintComponent(Graphics g, FCRMaster fcrMaster) {
        //战斗黑幕
        g.drawImage(ImageUtil.getImage("battleBG"), 0, fcv.getBattleY(), (int) (2000 * fcv.getProportion()),
                (int) (1200 * fcv.getProportion()), this);
        g.drawImage(ImageUtil.getImage("gamefightmenu"), (int) (1210 * fcv.getProportion()), (int) (840 * fcv.getProportion()), (int) (706 * fcv.getProportion()),
                (int) (237 * fcv.getProportion()), this);
        g.setFont(font1);

        int j = 0;
        //绘画战斗菜单名单
        for (int i = 0; i < fcv.getBattleWraps().size(); i++) {
            if (i == 4) {
                break;
            }
            FCPlayerBattleWrap w = fcv.getBattleWraps().get(i);
            if (!w.getHostUid().equals(gameSave.HOST_UID)) {
                continue;
            }
            FCPlayerInfo p = FCMutilPlayCache.findPlayerByName(w.getHostUid(), w.getName());
            if (fcv.getFightSelectPlayer() == i) {
                g.setColor(Color.WHITE);
                if (p != null && p.isDeath()) {
                    g.drawImage(ImageUtil.getImage("menudead"), (int) (1210 * fcv.getProportion()), (int) (840 * fcv.getProportion()), (int) (706 * fcv.getProportion()),
                            (int) (237 * fcv.getProportion()), this);
                }
            } else {
                g.setColor(Color.BLACK);
            }
            if (fcv.getEnterBu() == (80 + i)) {
                g.setColor(Color.BLUE);
            }

            UIConfigEntity fightMenuName = FCUIConfig.getIn().getByKey(fightMenuNames[j++]);
            int y = (int) (fightMenuName.getUiRect().y + (fightMenuName.getUiRect().height + 16 * fcv.getProportion()) / 2);
            g.drawString(p.getChName(), (int) (fightMenuName.getUiRect().x + 20 * fcv.getProportion()),
                    y);
        }

        FCPlayerBattleWrap selectwrap = fcv.getBattleWraps().get(fcv.getFightSelectPlayer());
        if (selectwrap.isBattleDriverTank()) {
            defMenulistner = tankMenuScreen;
            tankMenuScreen.paintComponent(g, fcrMaster);
        } else {
            defMenulistner = humanMenuScreen;
            humanMenuScreen.paintComponent(g, fcrMaster);
        }

        if (fcv.isBattleReady()) {

            //准备状态,就是备战状态
            for (FCPlayerBattleWrap wrap : fcv.getBattleWraps()) {
                g.setColor(Color.white);
                g.setFont(font2);
                FCPlayerInfo playerInfo = FCMutilPlayCache.findPlayerByName(wrap.getHostUid(), wrap.getName());
                if (playerInfo == null) {
                    continue;
                }

                tmpState.clear();
                if (playerInfo.isDeath()) {
                    g.drawImage(ImageUtil.getImage("mubei"), wrap.getCoorX(), wrap.getCoorY(),
                            wrap.getW(), wrap.getH(), this);
                } else {
                    if (!wrap.isBattleDriverTank() || playerInfo.getPlayertank1().equals("null")) { // 玩家1未驾驶坦克
                        g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getBeiZhan(),
                                wrap.getCoorX(), wrap.getCoorY(), wrap.getW(), wrap.getH(), this);

                        //npc的血量不显示
                        if (!"npc".equals(wrap.getHostUid())) {
                            g.drawString("血 " + playerInfo.getBlood() + "/" + playerInfo.getBloodMax(), (int) (wrap.getCoorX() + 100 * fcv.getProportion()),
                                    wrap.getCoorY() + (int) (52 * fcv.getProportion()));
                            g.drawString("甲 0/0", (int) (wrap.getCoorX() + 100 * fcv.getProportion()),
                                    wrap.getCoorY() + (int) (72 * fcv.getProportion()));
                        }
                    } else {
                        FCTank a = tankLib.getTankOfID(playerInfo.getPlayertank1(), playerInfo.getPlayertankHostId());
                        if (a != null) {
                            int centerX = wrap.getCoorX() + wrap.getW() / 2;
                            int tankW = (int) (a.getImageMasterSize()[0] * fcv.getProportion() * 2);
                            int tankH = (int) (a.getImageMasterSize()[1] * fcv.getProportion() * 2);
                            int tx = centerX - tankW / 2;
                            g.drawImage(a.getImageMaster(), tx, wrap.getCoorY(), tankW, tankH, this);
                            if (!"npc".equals(wrap.getHostUid())) {
                                g.drawString("血 " + playerInfo.getBlood() + "/" + playerInfo.getBloodMax(), (int) (wrap.getCoorX() + tankW),
                                        wrap.getCoorY() + (int) (52 * fcv.getProportion()));
                                g.drawString("甲 " + a.getDefense() + "/" + a.getMaxDefense(), (int) (wrap.getCoorX() + tankW),
                                        wrap.getCoorY() + (int) (72 * fcv.getProportion()));
                            }
                        }
                    }
                    boolean canBattle = true;
                    //不能战斗，麻痹，睡眠(死亡不会走这里代码）

                    if (wrap.getLongTermVal(FCRBattleOrderConstant.S_Sleep) != -1) {
                        canBattle = false;
                    }
                    if (wrap.getLongTermVal(FCRBattleOrderConstant.S_Paralysis) != -1) {
                        canBattle = false;
                    }
                    tmpState.addAll(wrap.getAllLongTermState());

                    if (canBattle && wrap.isBattleReady()) {
                        g.drawImage(ImageUtil.getImage("ready"),
                                (int) (wrap.getCoorX() + 10 * fcv.getProportion()),
                                (int) (wrap.getCoorY() - 22 * fcv.getProportion()),
                                (int) (68 * fcv.getProportion()),
                                (int) (40 * fcv.getProportion()), this);
                    }
                    if (tmpState.size() > 0) {
                        int start_x = (int) (wrap.getCoorX() + wrap.getW() / 2 - (tmpState.size() * 32 * fcv.getProportion() / 2));
                        int start_y = (int) (wrap.getCoorY() - 44 * fcv.getProportion());
                        for (int i = 0; i < tmpState.size(); i++) {
                            g.drawImage(ImageUtil.getImage(tmpState.get(i)),
                                    (int) (start_x + i * 32 * fcv.getProportion()), start_y, (int) (32 * fcv.getProportion()),
                                    (int) (32 * fcv.getProportion()), this);
                        }
                    }
                }
                g.setFont(font4);
                g.setColor(Color.WHITE);
                if (wrap.getShowAttackHurtTime() > 0) {
                    int startX = wrap.getCoorX() + wrap.getW() / 2 - SwingUtil.getStringWidht("-" + wrap.getShowAttckHurt(), font4) / 2;
                    int startY = wrap.getCoorY() - (int) (20 * fcv.getProportion());
                    g.drawString("-" + wrap.getShowAttckHurt(), startX, startY);
                }
                wrap.countShowAttactHurtTime();
            }

            g.setFont(font3);
            g.setColor(Color.WHITE);
            // 渲染怪物
            for (int i = 0; i < fcv.getBattleMonster().size(); i++) {
                FCMonster ms = fcv.getBattleMonster().get(i);
                if (!ms.getIsDeath() && ms.isShowInBattle()) {// 未死亡
                    Integer[] coor = fcv.getBattleMonsterCoor().get(i);
                    g.drawImage(ms.getPng(),
                            coor[0], coor[1], coor[2], coor[3], this);
                    //TODO 怪物的图标状态
                    ArrayList<String> iconState = ms.getAllLongTermState();
                    if (iconState.size() > 0) {
                        int startY = coor[1] - (int) (34 * fcv.getProportion());
                        for (int m = 0; m < iconState.size(); m++) {
                            g.drawImage(ImageUtil.getImage(iconState.get(m)),
                                    (int) (coor[0] + m * 32 * fcv.getProportion()), startY, (int) (32 * fcv.getProportion()),
                                    (int) (32 * fcv.getProportion()), this);
                        }
                    }
                }
                if (ms.isShowInBattle()) {
                    if (ms.getShowAttackHurtTime() > 0) {
                        Integer[] coor = fcv.getBattleMonsterCoor().get(i);
                        int startX = coor[0] + coor[2] / 2 - SwingUtil.getStringWidht("-" + ms.getShowAttckHurt(), font3) / 2;
                        int startY = coor[1] - (int) (6 * fcv.getProportion());
                        g.drawString("-" + ms.getShowAttckHurt(), startX, startY);
                    }
                    ms.countShowAttactHurtTime();
                }
            }

            if (fcv.getBattleShowingList().size() > 0) {
                g.setFont(font1);

                g.drawImage(ImageUtil.getImage("gamebattlelisthead"), fcv.getBattleShowListX(), fcv.getBattleShowListY(),
                        (int) (250 * fcv.getProportion()), (int) (19 * fcv.getProportion()), this);
                int i = 0;
                int y1 = 0;
                for (i = 0; i < fcv.getBattleShowingList().size(); i++) {
                    g.setColor(Color.WHITE);
                    y1 = (int) ((19 + 44 * i) * fcv.getProportion()) + fcv.getBattleShowListY();
                    g.drawImage(ImageUtil.getImage("gamebattlelistbody"), fcv.getBattleShowListX(),
                            y1, (int) (250 * fcv.getProportion()), (int) (44 * fcv.getProportion()), this);
                    String text = fcv.getBattleShowingList().get(i);
                    FCItem tmp = null;
                    if (text.contains("-")) {
                        String[] strings = text.split("-");
                        tmp = itemLib.getItemOfID(strings[0]);
                        text = tmp.getChName() + "  余" + strings[1];
                    } else if (text.contains("@")) {
                        tmp = itemLib.getItemOfID(text.split("@")[0]);
                        text = tmp.getChName() + " (人)";
                    } else if (text.contains(";")) {
                        tmp = itemLib.getItemOfID(text.split(";")[0]);
                        text = tmp.getChName() + " (车)";
                    }
                    if (fcv.getMouseX() > fcv.getBattleShowListX() && fcv.getMouseX() < fcv.getBattleShowListX() + 250 * fcv.getProportion()) {
                        if (fcv.getMouseY() > y1 && fcv.getMouseY() < y1 + 44 * fcv.getProportion()) {
                            g.setColor(Color.BLUE);
                        }
                    }

                    int y = (int) (fcv.getBattleShowListY() + 44 * fcv.getProportion() / 2 + SwingUtil.getStringHeight(text, font1));
                    int x = (int) (fcv.getBattleShowListX() + (250 * fcv.getProportion() - SwingUtil.getStringWidht(text, font1)) / 2);
                    g.drawString(text, x, (int) (44 * i * fcv.getProportion() + y));
                }
                g.drawImage(ImageUtil.getImage("gamebattlelistfoot"), fcv.getBattleShowListX(),
                        (int) ((19 + 44 * i) * fcv.getProportion()) + fcv.getBattleShowListY(), (int) (250 * fcv.getProportion()),
                        (int) (19 * fcv.getProportion()), this);
            }
        } else {
            fcv.setBattlePlayerSelect(false);
            FCBattleOrder battleOrder = fcv.getBattleAttackOrder().peek();
            ABattleAni aBattleAni = null;

            if (battleOrder != null && battleOrder.battleAnis != null && battleOrder.battleAnis.size() > 0) {
                aBattleAni = battleOrder.battleAnis.get(0);
            }
            g.setFont(font3);
            g.setColor(Color.WHITE);
            // 渲染怪物
            for (int i = 0; i < fcv.getBattleMonster().size(); i++) {
                FCMonster tmpMs = fcv.getBattleMonster().get(i);
                if (!tmpMs.getIsDeath() && tmpMs.isShowInBattle()) {// 未死亡
                    boolean showIt = true;
                    int offsetX = 0;
                    if (aBattleAni != null) {
                        if (battleOrder.battleType == 1) {
                            //就是玩家操作打怪
                            if (aBattleAni.hitFcMonsters.contains(tmpMs)) {
                                showIt = aBattleAni.beHitShowVisable;
                            }
                        } else {
                            if (battleOrder.monsterNum == i) {
                                //怪打人
                                offsetX = aBattleAni.getPlayerOffset()[0];
                            }
                        }
                    }
                    Integer[] coor = fcv.getBattleMonsterCoor().get(i);
                    //   if (showIt) {
                    g.drawImage(tmpMs.getPng(),
                            coor[0] + offsetX, coor[1], coor[2], coor[3], this);
                    //    }

                    //TODO 怪物的图标状态
                    ArrayList<String> iconState2 = fcv.getBattleMonster().get(i).getAllLongTermState();
                    if (iconState2.size() > 0) {
                        int startY = coor[1] - (int) (34 * fcv.getProportion());
                        for (int n = 0; n < iconState2.size(); n++) {
                            g.drawImage(ImageUtil.getImage(iconState2.get(n)),
                                    (int) (coor[0] + n * 32 * fcv.getProportion()), startY, (int) (32 * fcv.getProportion()),
                                    (int) (32 * fcv.getProportion()), this);
                        }
                    }
                }
                if (tmpMs.isShowInBattle()) {
                    if (tmpMs.getShowAttackHurtTime() > 0) {
                        Integer[] coor = fcv.getBattleMonsterCoor().get(i);
                        int startX = coor[0] + coor[2] / 2 - SwingUtil.getStringWidht("-" + tmpMs.getShowAttckHurt(), font3) / 2;
                        int startY = coor[1] - (int) (6 * fcv.getProportion());
                        g.drawString("-" + tmpMs.getShowAttckHurt(), startX, startY);
                    }
                    tmpMs.countShowAttactHurtTime();
                }
            }
            g.setFont(font4);
            g.setColor(Color.WHITE);
            // 渲染玩家，应该渲染在队伍里的就行了
            for (FCPlayerBattleWrap wrap : fcv.getBattleWraps()) {
                int offsetX = 0;
                boolean showIt = true;
                //是否是正在主动出列战斗的那个
                boolean isTheOneWhoAttack = false;
                if (aBattleAni != null && battleOrder.playerName.equals(wrap.getName()) && battleOrder.playerUid.equals(wrap.getHostUid())) {
                    if (battleOrder.battleType == 2) {
                        if (aBattleAni.hitFcPlayerWrap.contains(wrap)) {
                            //      showIt = aBattleAni.beHitShowVisable;
                        }
                    } else {
                        offsetX = aBattleAni.getPlayerOffset()[0];
                        isTheOneWhoAttack = true;
                    }
                }

                if (showIt) {
                    FCPlayerInfo playerInfo = FCMutilPlayCache.findPlayerByName(wrap.getHostUid(), wrap.getName());
                    if (playerInfo == null) {
                        continue;
                    }
                    if (playerInfo.isDeath()) {
                        g.drawImage(ImageUtil.getImage("mubei"), wrap.getCoorX(),
                                wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                        continue;
                    }
                    if (!wrap.isBattleDriverTank() || playerInfo.getPlayertank1().equals("null")) {
                        //TODO 人物没驾驶着坦克
                        if (isTheOneWhoAttack) {//只有战斗中的人物才走这里，否则全部，备战站好
                            if (wrap.getBattleAttackOrder() == FCRBattleOrderConstant.Order_Attack) {// 攻击
                                if (wrap.getBattlePlayerSelectMenu() == FCRBattleOrderConstant.BattleSelectMenuTushou) {// 徒手攻击
                                    g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getTuShou(),
                                            wrap.getCoorX() - offsetX, wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                } else if (wrap.getBattlePlayerSelectMenu() == FCRBattleOrderConstant.BattleSelectMenuArmGun) {// 武器攻击
                                    if (wrap.getUseWeaponType().equals(FCRBattleOrderConstant.WT_DanGong)) {
                                        g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getDanGong(),
                                                wrap.getCoorX() - offsetX, wrap.getCoorY(), wrap.getW(), wrap.getH(), this);// 渲染人物弹弓动作
                                    } else if (wrap.getUseWeaponType().equals(FCRBattleOrderConstant.WT_Qiang)) {
                                        g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getQiTa(), wrap.getCoorX() - offsetX,
                                                wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                    } else if (wrap.getUseWeaponType().equals(FCRBattleOrderConstant.WT_Dao)) {
                                        if (aBattleAni.attackReadyState) {
                                            g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getPngbadao(), wrap.getCoorX() - offsetX,
                                                    wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                        } else {
                                            g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getPngDao(), wrap.getCoorX() - offsetX,
                                                    wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                        }
                                    } else if (wrap.getUseWeaponType().equals(FCRBattleOrderConstant.WT_HuoPao)) {
                                        g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getPngHuoPao(), wrap.getCoorX() - offsetX,
                                                wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                    } else if (wrap.getUseWeaponType().equals(FCRBattleOrderConstant.WT_HuiXuanBiao)) {
                                        g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getTuShou(), wrap.getCoorX() - offsetX,
                                                wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                    } else {
                                        g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getTuShou(),
                                                wrap.getCoorX() - offsetX, wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                    }
                                }
                            } else if (wrap.getBattleAttackOrder() == FCRBattleOrderConstant.Order_Run) {
                                g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getBeiZhan(),
                                        wrap.getCoorX() + offsetX, wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                            } else if (wrap.getBattleAttackOrder() == FCRBattleOrderConstant.Order_USEITEM) {
                                //投掷
                                if (aBattleAni.attackReadyState) {
                                    g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getPngThrowReady(), wrap.getCoorX() - offsetX,
                                            wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                } else {
                                    g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getPngThrowEnd(), wrap.getCoorX() - offsetX,
                                            wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                                }
                            } else {// 非攻击
                                g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getBeiZhan(),
                                        wrap.getCoorX() - offsetX, wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                            }
                        } else {
                            g.drawImage(charLib.getCharacterOfName(playerInfo.getSelectPlayer()).getBeiZhan(),
                                    wrap.getCoorX(), wrap.getCoorY(), wrap.getW(), wrap.getH(), this);
                        }
                    } else {
                        //TODO 人物驾驶着坦克
                        FCTank a = tankLib.getTankOfID(playerInfo.getPlayertank1(), playerInfo.getPlayertankHostId());
                        if (a != null) {
                            int centerX = wrap.getCoorX() + wrap.getW() / 2;
                            int tankW = (int) (a.getImageMasterSize()[0] * fcv.getProportion() * 2);
                            int tankH = (int) (a.getImageMasterSize()[1] * fcv.getProportion() * 2);
                            int tx = centerX - tankW / 2;
                            g.drawImage(a.getImageMaster(), tx - offsetX, wrap.getCoorY(), tankW, tankH, this);
                        }
                    }

                    tmpState.clear();
                    tmpState.addAll(wrap.getAllLongTermState());
                    if (tmpState.size() > 0) {
                        int start_x = (int) (wrap.getCoorX() + wrap.getW() / 2 - (tmpState.size() * 32 * fcv.getProportion() / 2));
                        int start_y = (int) (wrap.getCoorY() - 44 * fcv.getProportion());
                        for (int i = 0; i < tmpState.size(); i++) {
                            g.drawImage(ImageUtil.getImage(tmpState.get(i)),
                                    (int) (start_x + i * 32 * fcv.getProportion()), start_y, (int) (32 * fcv.getProportion()),
                                    (int) (32 * fcv.getProportion()), this);
                        }
                    }
                    if (wrap.getShowAttackHurtTime() > 0) {
                        int startX = wrap.getCoorX() + wrap.getW() / 2 - SwingUtil.getStringWidht("-" + wrap.getShowAttckHurt(), font4) / 2;
                        int startY = wrap.getCoorY() - (int) (20 * fcv.getProportion());
                        g.drawString("-" + wrap.getShowAttckHurt(), startX, startY);
                    }
                    wrap.countShowAttactHurtTime();
                }
                if (battleOrder != null && battleOrder.battleAnis != null) {
                    for (ABattleAni ani : battleOrder.battleAnis) {
                        ani.paintBattleSceen(g, fcrMaster);
                    }
                }
            }
        }
    }

    @Override
    protected void setBounds() {
        font1 = new Font(FCRConstants.FONT_BLACK, 0, (int) (24 * fcv.getProportion()));
        font2 = new Font(FCRConstants.FONT_BLACK, Font.BOLD, (int) (20 * fcv.getProportion()));
        font3 = new Font(FCRConstants.FONT_ELEGANT_BLACK, Font.BOLD, (int) (40 * fcv.getProportion()));
        font4 = new Font(FCRConstants.FONT_ELEGANT_BLACK, Font.BOLD, (int) (30 * fcv.getProportion()));
        humanMenuScreen.setBounds();
        tankMenuScreen.setBounds();
    }

    private void selectPlayer(int num) {
        if (num != fcv.getFightSelectPlayer()) {
            FCPlayerBattleWrap wrap = fcv.getBattleWraps().get(num);
            //不是本机的角色不给点
            if (wrap.getHostUid().equals(gameSave.HOST_UID)) {
                fcv.setFightMenuBntSelect(-1);
                fcv.setFightSelectPlayer(num);
                humanMenuScreen.resetUI();
                tankMenuScreen.resetUI();
                FCRMaster.fcv.setShowWhosBagItem(wrap.getName());
            }
        }
    }


    public void selectNextPlayer() {
        for (int i = 0; i < fcv.getBattleWraps().size(); i++) {
            FCPlayerBattleWrap playerBattleWrap = fcv.getBattleWraps().get(i);
            if (playerBattleWrap.getHostUid().equals(FCRMaster.gameSave.HOST_UID) && !playerBattleWrap.isBattleReady()) {
                fcv.setFightMenuBntSelect(-1);
                fcv.setFightSelectPlayer(i);
                FCRMaster.fcv.setShowWhosBagItem(playerBattleWrap.getName());
                humanMenuScreen.resetUI();
                tankMenuScreen.resetUI();
                break;
            }
        }
    }
}
